#include ("/_includes/_layout.html")
#@layout("红包记录", "wxmall,点步科技", "Wxmall社区","wxmall") #define content()
<div class="wrapper wrapper-content">
	<div class=" content-tabs">
		<nav class="page-tabs J_menuTabs">
	       <div class="page-tabs-content" style="margin-left: 0px;">
	       <div class="page-tabs-content" >
	       	   <a href="#(webctx)/user/balance" class="J_menuTab">在线充值</a>
	           <a href="#(webctx)/user/balance/recharge" class="J_menuTab">我的充值记录</a>
	           <a href="#(webctx)/user/balance/rcd" class="J_menuTab active">我的红包记录</a>
	       </div>
	       </div>
	   	</nav>
	</div>
	<div class="content  ibox-content">
		<div class="panel-body">
			<div id="pager" class="jqpager" style="margin-bottom: 1px;"></div>	
		</div>
		<table id="mainTable" class="table table-striped table-bordered bootstrap-datatable datatable" border="0">
		  <thead>
			  <tr>
				<th><input type="checkbox" id="all" title="全选/反选" style="margin-right: 4px; vertical-align: middle;"/></th>
				<th>红包金额（元）</th>
				<th>领取用户</th>
				<th>领取时间</th>
			  </tr>
		  </thead>   
		  <tbody class="itemsLotGrid"></tbody>
	  	</table>
	</div>
</div>
<script type="text/html" id="item_table_tr_tpl">
{{each list as item i}}
		<tr class="package">
			<td><input type="checkbox" class="commchk" id="checkbox_{{item.id}}" style="margin-right: 4px; vertical-align: middle;"/></td>
			<td>{{item.balance}}</td>
			<td>{{item.openid}}</td>
			<td>{{item.created}}</td>
		</tr>
{{/each}}
</script>
<script type="text/template" id="table_noresult_tr_tpl">
	<tr class="package"><td colspan="8" class="center">没有结果集</td></tr>
</script>
#end
<script type="text/javascript">
$(document).ready(function() {
	var params = {};
	params.status = $("#a_status_sel").val();
	var table = new obz.TableView("pager", obz.ctx + "/user/balance/rcdlist", params, function(resp){
		$(".itemsLotGrid").empty();
		if(resp && resp.list && resp.list.length>0){
			$('.itemsLotGrid').html(template('item_table_tr_tpl', resp));
			//初始化checkbox点击事件
			TBatch.checkCheckbox();
			TBatch.initCheckboxClick();
			TBatch.initOptEvent(TableOpt.init());
		}else{
			$(".itemsLotGrid").append($("#table_noresult_tr_tpl").html());
		}
	});
	table.init();
	
	var TableOpt = {
		init : function(){
			var optArray = new Array();
			return optArray;
		}
	}
	
	$("#myqueryBtn").click(function(){
		params.status = $("#a_status_sel").val();
		table.init();
	});
	
	$("#a_status_sel").change(function(){
		params.status = $("#a_status_sel").val();
		table.init();
	});
});
</script>